//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "templateManager.h"
///////////////////////////////////////////////////////////////////////////////////
ClayerAttribArray::ClayerAttribArray()
{

}
ClayerAttribArray::~ClayerAttribArray()
{
	removeAll();
}
	
int ClayerAttribArray::add()
{
	layerAttrib * PlayerAttrib= new layerAttrib;
	initData(PlayerAttrib);
	return Add(PlayerAttrib);
}
void ClayerAttribArray::insertAt(int number)
{
	if (number>=0&&number<GetSize())
	{
		layerAttrib * PlayerAttrib= new layerAttrib;
		initData(PlayerAttrib);
		InsertAt(number,PlayerAttrib);
	}
	else
		add();
}
void ClayerAttribArray::initData(layerAttrib * PlayerAttrib)
{
	PlayerAttrib->m_Color=0;
	PlayerAttrib->m_code.Empty();
	PlayerAttrib->m_description.Empty();
	PlayerAttrib->m_name.Empty();
	PlayerAttrib->m_quHao=0;
	PlayerAttrib->m_convertLayer.Empty();
	PlayerAttrib->m_reserved=0;
	PlayerAttrib->m_convertLineStyle.Empty();
	PlayerAttrib->m_clipStatus=0;
	PlayerAttrib->m_ouputStatus=0;
}
layerAttrib * ClayerAttribArray::getAt(int number)
{
	if (number<0||number>GetUpperBound())
		return NULL;
	return GetAt(number);
}
void ClayerAttribArray::setAt(int number,layerAttrib * OlayerAttrib)
{
	if (number<0||number>GetUpperBound())
		return ;
	layerAttrib * PlayerAttrib =GetAt(number);
	* PlayerAttrib=*OlayerAttrib;
	return ;
}
void ClayerAttribArray::removeAt(int number)
{
	if (number<0||number>GetUpperBound())
		return ;	
	delete GetAt(number);
	RemoveAt(number);

	return ;
}
void ClayerAttribArray::removeAll()
{
	int number=GetSize();
	if (number==0)
		return ;
	while(number--)
	{
		delete GetAt(number);
	}
	RemoveAll();

	return ;
}
int ClayerAttribArray::getUpperBound()
{
	return GetUpperBound();
}
int ClayerAttribArray::getSize()
{
	return GetSize();
}
